const { createProxyMiddleware } = require('http-proxy-middleware')


module.exports = function (app) {
  // 创建中间件
  app.use(
    createProxyMiddleware('/jian', {
      target: 'https://www.jianshu.com/asimov',
      changeOrigin: true,
      ws: true,
      pathRewrite: {
        '^/jian': ''
      }
    })
  )

  app.use(
    createProxyMiddleware('/zhi', {
      target: 'https://new-at.zhihu.com/api/4',
      changeOrigin: true,
      ws: true,
      pathRewrite: {
        '^/zhi': ''
      }
    })
  )
}